import java.util.ArrayList;
import java.util.ListIterator;

public class ListIteratorTest {
    public static void main(String[] args) {
        String[] books = {
                "Java从入门到精通", "Java项目实战",
                "数据结构与算法", "机器学习"
        };
        ArrayList bookList = new ArrayList();
        for (int i = 0; i < books.length; i++) {
            bookList.add(books[i]);
        }
        ListIterator lit = bookList.listIterator();
        while (lit.hasNext()) {
            System.out.println(lit.next());
            lit.add("---------分隔符---------");
        }
        System.out.println("==========下面开始反向迭代=========");
        while (lit.hasPrevious()) {
            System.out.println(lit.previous());
        }
    }
}
